﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit-category.aspx.cs" Inherits="EnmineKaitlin.admin.edit_category" MasterPageFile="~/MasterPage/AdminDefault.Master" %>
<%@ Register src="../Common/DropDowListCategory.ascx" tagname="DropDowListCategory" tagprefix="uc1" %>
<%@ Register Assembly="EnmineKaitlin" Namespace="EnmineKaitlin.Common" TagPrefix="Pagging" %>
<asp:Content ID="ctneditcategory" runat="server" ContentPlaceHolderID="cphContent">
    <div class="form list">
        <h2><span class="icon"><img src="../images/admin/Play.png"></span>Chuyên mục</h2>
        <div class="content">
            <div class="left add-category">
                <h3>Thêm chuyên mục</h3>
                <p class="label">Ngôn ngữ:
                    <asp:DropDownList ID="ddlLanguage" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlLanguage_SelectedIndexChange">
                        <asp:ListItem Text="Tiếng Việt" Value="vn"></asp:ListItem>
                        <asp:ListItem Text="English" Value="en"></asp:ListItem>
                    </asp:DropDownList>
                </p>
                <p class="label">Tên chuyên mục:</p>
                <p class="input"><asp:TextBox ID="txtCatName" Width="300" runat="server" CssClass="txt required"></asp:TextBox></p>
                <p class="label">Chuyên mục cha:</p>
                <p class="input"><uc1:DropDowListCategory ID="DropDowListCategory" runat="server" Width="302" /></p>            
                <p class="label">Mô tả:</p>
                <p class="input"><asp:TextBox ID="txtDescription" CssClass="textarea" runat="server" TextMode="MultiLine" Width="291" Height="100" Rows="5"></asp:TextBox></p>
                <p class="label">Ảnh đại diện:<input type="button" value="Chọn ảnh đại diện" class="link-btn" onclick="BrowseServer();" /></p>
                <p>&nbsp;<asp:HiddenField ID="hdfFeaturedImage" runat="server" /></p>                
                <p class="input">
                    <asp:Image ID="imgFeaturedImage" runat="server" CssClass="imgFeaturedImage" Width="300" Height="100" />                    
                </p>
                <p class="input"><asp:Button ID="btnAddCat" runat="server" Text="Thêm chuyên mục" CssClass="btn right" CommandName="Add" OnCommand="btnAddCat_Click" /></p>
            </div>
            <div class="list-cat-right">
                <asp:Label ID="lblNotice" runat="server" CssClass="error"></asp:Label>
                <div class="filter">                    
                    <div class="function left">
                        <asp:LinkButton ID="lbtFunctionTop" runat="server" Text="Xóa chuyên mục" CssClass="link-btn fbtnDelete" CommandName="BunkFunction" OnCommand="lbtFunction_Click" CommandArgument="TopFunction"></asp:LinkButton>
                        &nbsp;&nbsp;&nbsp;&nbsp;Ngôn ngữ:&nbsp;
                        <asp:DropDownList ID="ddlLanguageFilter" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlLanguageFilter_SelectedIndexChange">
                            <asp:ListItem Text="Tiếng Việt" Value="vn"></asp:ListItem>
                            <asp:ListItem Text="English" Value="en"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div class="function left">
                        &nbsp;&nbsp;&nbsp;&nbsp;Chuyên mục cha:&nbsp;
                        <uc1:DropDowListCategory ID="ucddlcCategoryFilter" runat="server" />&nbsp;&nbsp;
                        <asp:LinkButton ID="lblFilter" Text="Lọc" CssClass="link-btn" runat="server" OnClick="lbtFilter_Click"></asp:LinkButton>
                    </div>                                                   
                </div>
                <asp:GridView ID="grvCategory" runat="server" AutoGenerateColumns="false" 
                    DataKeyNames="CatID" Width="100%" 
                    CssClass="tbl-list" AlternatingRowStyle-BackColor="AntiqueWhite" OnRowDataBound="grvCategory_RowDataBound" 
                    OnRowCommand="grvCategory_RowCommand" 
                    onrowdeleting="grvCategory_RowDeleting">
                    <Columns>
                        <asp:TemplateField HeaderText="">
                            <ItemTemplate><asp:CheckBox runat="server" CssClass="cbxItem" /></ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="CatID">
                            <ItemTemplate><%#Eval("CatID") %></ItemTemplate>
                        </asp:TemplateField>    
                        <asp:BoundField HeaderText="Tên chuyên mục" DataField="CatName" />                    
                        <asp:BoundField HeaderText="Mô tả" DataField="Description" />
                        <asp:TemplateField HeaderText="Chuyên mục cha">
                            <ItemTemplate>
                                <%#get_category_name(int.Parse(Eval("CatParent").ToString())) %>                                
                            </ItemTemplate>
                            <EditItemTemplate><uc1:DropDowListCategory ID="ddlcParent" runat="server" SelectedValue='<%#Eval("CatParent") %>' /></EditItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Thao tác" ItemStyle-Width="60">
                            <ItemTemplate>
                                <a href='/admin/edit-category.aspx?cat=<%#Eval("CatID") %>' class="btnEdit">Sửa</a>
                                <asp:LinkButton ID="lbtDelete" runat="server" CssClass="btnDelete" Text="Xóa" CommandName="Delete" CommandArgument='<%#Eval("CatID") %>'></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <div class="pagenav">
                    <Pagging:PaggingControl runat="server" ID="ctlPagging" Mode="Url" PageSize="20"
                    PreviousClause="<img src='../images/Back.png'/>" NextClause="<img src='../images/Forward.png'/>" />
                </div>
                <div class="filter">
                    <div class="function left">
                        <asp:LinkButton ID="lbtFunctionBottom" runat="server" Text="Xóa chuyên mục" CssClass="link-btn fbtnDelete" CommandName="BunkFunction" OnCommand="lbtFunction_Click" CommandArgument="BottomFunction"></asp:LinkButton>	            
                    </div>                                
                </div>
            </div>
        </div>
    </div>
</asp:Content>
